# 编写读取登陆的数据文件函数
import json


def read_data(filename):
    """
    :param filename:  要传入的外部登陆的数据文件路径
    :return:
    """
    with open(filename, mode='r', encoding="utf-8") as f:
        jsonData = json.load(f)  # 将读取的数据流f，转化为json数据
        result_list = list()  # 定义空列表存放转化之后的数据
        for login_data in jsonData:
            result_list.append(tuple(login_data.values()))  # 将列表字典数据，转化为列表元组数据，并添加到空列表当中，整合成parameterized所需要的列表元素数据

        print(result_list)

    return result_list


def read_emp_data(filename, interface):
    with open(filename, mode='r', encoding="utf-8") as f:
        jsonData = json.load(f)  # 将读取的数据流f，转化为json数据
        result_list = list()  # 定义空列表存放转化之后的数据
        for login_data in jsonData:
            data = login_data.get(interface)
            result_list.append(tuple(data.values()))
        print(result_list)
    return result_list


if __name__ == '__main__':
    filename = "./data/login.json"
    read_data(filename)  # 调试
    filename = './data/emp_data.json'
    read_emp_data(filename, "query_emp_list")


def read(path):
    with open(path, mode='r', encoding='utf-8') as f:
        content = json.load(f)
        list = []
        for data in content:
            list.append(tuple(data.values()))
    return list


def read_emp(path, interface):
    with open(path, mode='r', encoding='utf-8') as f:
        content = json.load(f)
        emp_list = []
        for data in content:
            data1 = data.get(interface)
            emp_list.append(data1.values())

















